package concurrent.completationstage.realexample;

import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import org.testng.annotations.Test;

public class ThenMethods {
    @Test
    public void t1() throws ExecutionException, InterruptedException {
        CompletableFuture<Void> future = CompletableFuture.supplyAsync(() -> {
            System.out.println(Thread.currentThread());
            int i = new Random().nextInt(10);
            System.out.println(i);
            return i;
        }).thenRun(() -> {
            System.out.println(Thread.currentThread());
            System.out.println("thenRun ...");
        });
//        future.get();
    }

}
